<template>
    <div class="toolbar">
        <el-pagination
                background
                layout="prev, pager, next"
                :page-count="$store.state.pageSum"
                :current-page="$store.state.pageIndex"
                @current-change="pageIndex=>$store.dispatch(actionsName,{
                ...{pageIndex},
                ...query
                })">
        </el-pagination>
    </div>
</template>

<script>
    export default {
        name: "PageInfo",
        props:{
            actionsName:{
                type:String,
                default:""
            },
            query:{
                //设置的类型是一个对象或数组，默认值需要通过工厂模式进行生成
                type:Object,
                default:()=>{return{}}
            }
        },
        mounted(){
            this.$store.dispatch(this.actionsName,this.query);
        }
    }
</script>
<style scoped>

</style>

